<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //1.onketyup:某个键盘你按键被松开的时候触发
        document.addEventListener('keyup', function (event) {
            console.log(event);
            console.log('onkeyup======' + event.key);
        })

        //2.onkeydown :某个键盘按键被按下时触发.： 如果按下某个按键一直不松开，会一直被调用
        document.addEventListener('keydown', function(event) {
            console.log(('ondown===='+ event.key));
        })

        //3.onkeypress: 键盘某个按键被按下时被调用，但是它不识别功能键， ctrl、shift  箭头等
        document.addEventListener('keypress', function(event) {
            console.log('onkeypress========' + event.key);
        })

    </script>
</body>
</html>